﻿/*  DISCLAIMER ***

    Copyright (c) 2014 Michael T. Joiner

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 
    to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  
 */

#region Using Statements

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

#endregion

namespace Application.SceneEditor.Data
{
    /// <summary>
    /// Provides an object indicating the state of the editor
    /// </summary>
    public sealed class EditorState : BaseNotifier
    {
        #region Properties

        /// <summary>
        /// Gets a collection of Entities this object hosts
        /// </summary>
        public ObservableCollection<Entity> EntityCollection { get { return m_EntityCollection; } }

        #endregion

        #region Methods

        #region Constructors

        /// <summary>
        /// Constructs a new instance of this object
        /// </summary>
        static EditorState()
        {
            m_EntityCollection = new ObservableCollection<Entity>();
        }

        /// <summary>
        /// Constructs a new instance of this object
        /// </summary>
        public EditorState()
        {

        }

        #endregion

        /// <summary>
        /// Adds a new entity object to this object
        /// </summary>
        /// <typeparam name="T">The type of the entity to host</typeparam>
        /// <param name="entity">The entity object to host</param>
        public static void AddEntity<T>(T entity) where T : Entity
        {   
            m_EntityCollection.Add(entity);
        }

        /// <summary>
        /// Provides a means for removing entites from the host collection
        /// </summary>
        /// <param name="entity">The entity to remove from host collection</param>        
        public static bool RemoveEntity(Entity entity)
        {
            return m_EntityCollection.Remove(entity);
        }

        /// <summary>
        /// Provides a means for serializing the host object to disk
        /// </summary>
        /// <param name="fileLocation">a string value representing the location on disk to serialize the host collection</param>
        public static void Save(string fileLocation)
        {
            // Provide way to save the SceneSave object to disk
        }

        #endregion 
       
        private static ObservableCollection<Entity> m_EntityCollection;
    }
}
